package controller;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import models.Domain;
import server.UpdateDomain;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;

public class SearchServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		
		String name = req.getParameter("name");
		name = Utils.fomatDomain(name);
		if(name!=null&&Utils.checkDomain(name))
		{
			resp.sendRedirect("/d/"+name);
			return;
		} else {
			resp.sendRedirect("/gsearch?cx=012442764171928889326:_zsyjyuyyuu&cof=FORID%3A10&ie=UTF-8&q="+name+"&sa=Search");
		}
	}
}
